﻿<!--#include file="../inc/easp/easp.asp"-->
<!--#include file="../inc/Conn1.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/checklogin.asp"-->
<% CheckLogin("../index.asp") %>
<%
	If Session("Authority")<>"0" Then
		Response.Write "<script type=""text/javascript"">top.location.href='../main.asp';</script>"
	end if				
%>
<%
dim pid,result,yid
dim rscountry
dim epage
dim i
dim hasdata

IF (request.QueryString("action")="del") Then
    pid=request.QueryString("pid")
    yid=request.QueryString("yid")

    if(pid<>"") then
        result = Easp.db.DeleteRecord("Province", "p_id:" &pid)   
        If result<>0 Then  
            Response.Write("Delete Data Sucess!") 
            response.write("<Script language=JavaScript>alert('Delete Data Sucess!');</Script>")  
        End If  
        
        Response.Redirect "Province.asp?action=det&yid="&yid
    else
        
    End if   
    
ElseIf (request.QueryString("action")="det" )Then
    yid=request.QueryString("yid")
    if (yid<>"") then
        yid=CStr(yid)
    end if

    set rscountry = Easp.db.GetRecordBySQL("Select p_id,ProvinceName,y_id From Province where y_id ="&yid)  
    
    if not Easp.IsN(rscountry) then
        rscountry.pagesize=20

        if request("page")<>"" then
          epage=CStr(request("page"))
           if epage<1 then epage=1 end if
           if epage>rscountry.pagecount then epage=rscountry.pagecount end if
        else
            epage=1
        end if
        rscountry.absolutepage=epage
        hasdata="true"
   else
        hasdata="false"
   end if
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Holiday Control</title>
<link rel="stylesheet" type="text/css" href="../css/theme.css" />
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<script type="text/javascript">
	var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
	document.writeln('<link rel="stylesheet" type="text/css" href="../css/' + StyleFile + '">');
</script>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
<![endif]-->
</head>
<body>

<div id="container">
	<div id="header">
    <div id="divAccount" style="float:right;">
        <a href="../user/account.asp" style="color:white">Account</a>&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="../inc/logout.asp" style="color:white">Logout</a>
      </div>
		<h2>Province Control</h2>
		<div id="topmenu">
			<ul>
				<li><a href="../main.asp">Home</a></li>
				<li class="current"><a href="#">Country</a></li>
				<li><a href="../Holiday/index.asp">Holiday</a></li>
				<li><a href="../Times/index.asp">Times</a></li>
				<li><a href="../wallboard/index.asp">WallBoard</a></li>
				<%
				   If Session("Authority")="0" Then 
				       Response.Write("<li><a href='../user/index.asp'>User</a></li>")
				   End if
				%>
				<li><% If Session("Passed")=true Then %><a href="../inc/logout.asp">Logout</a><% End If %></li>
			</ul>
		</div>
	</div>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<li><a href="<%=request.serverVariables("Http_REFERER")%>" class="goback">GoBack</a></li>
			</ul>
		</div>
	</div>
	<div id="wrapper">
		<div id="content">
			<form name="myform" action="index.asp" method="post">
				<div id="box">
					<h3>Country->Province</h3>
					<table width="100%" style="text-align: center;">
                          <p> 
                                <table border="0" cellpadding="0" cellspacing="1" bgcolor="#0000FF" width="80%" align="center">
                                <tr bgcolor="#FFFFFF" align="center">
                                <%  if hasdata="true" then%>
                                <th>Code</th><th>Province</th><th>Delete</th><th>Edit</th><th>Details</th>
                                </tr>
                                 <%end if %> 
                                
                                <%
                                if hasdata="true" then
                               
                                for i=0 to rscountry.pagesize-1
                                    if rscountry.bof or rscountry.eof then exit for

                                %>
                                <tr bgcolor="#FFFFFF" align="center">
                                    <td><%=rscountry(0).value%></td>
                                    <td><%=rscountry(1).value%></td>
                                
                                    <td><%="<a href='Province.asp?action=del&pid="&rscountry(0).value&"&yid="&rscountry(2).value&"'>Delete</a>"%>
                                    </td>
                                     <td><a href="edit.asp?page=province&yid=<%=rscountry(2).value%>&pid=<%=rscountry(0).value%>&provincename=<%=rscountry(1).value%>">Edit</a> </td>

                                    <td><%="<a href='City.asp?action=det&pid="&rscountry(0).value&"'>Details</a>"%></td>
                                </tr>
                                <%
                                rscountry.movenext()
                                next
                                
                                end if
                                
                                if hasdata="true" then%>
                                </table>
                                <p align="center">
                                <a href="Province.asp?action=det&yid=<%=yid%>">First</a>&nbsp;
                                <a href="Province.asp?action=det&yid=<%=yid%>&page=<%=epage-1%>">Previous</a>&nbsp;
                                <a href="Province.asp?action=det&yid=<%=yid%>&page=<%=epage+1%>">Next</a>&nbsp;
                                <a href="Province.asp?action=det&yid=<%=yid%>&page=<%=rscountry.pagecount%>">Last</a>
                                </p>
                                <p align="center">Now at <%=epage%>page ,Totle<%=rscountry.pagecount%> pages</p>
                                <%
                                Easp.db.C(rscountry) 
                                
                                else%>
                               <h4> Has no data!</h4>
                                <%
                                end if
                                %>  
                          </p>
						<thead>
							<!--<tr>
								<th width="81" class="a-center"><a href="#">Country</a></th>
								<th width="360" class="a-center"><a href="#">Province</a></th>
								<th width="81" class="a-center"><a href="#">City</a></th>

							</tr>-->
						</thead>
						<tbody>
						
                      
							
						</tbody>
					</table>
					<div id="pager">
				
						<!--input type="hidden" name="Country" value="<%= Session("Country") %>" /-->
						<!--input class="btn" type="submit" value="Save-<%= Session("Country") %>" /-->
					<!--	<input name="add" type="button" class="btn" value="add" onclick="window.open('add.asp?page=province&yid=<%=yid%>', '', '');"/>-->
						
						
						<%
					            If Session("Authority")="0" Then%>
					              <input name='add' type='button' class='btn' value='add' onclick="top.location.href='add.asp?page=province&yid=<%=yid%>';"/>
					      <%        'Easp.wc "<input name='add' type='button' class='btn' value='add' onclick='Add()'/>"
						        End if
                            %>
						<!--input name="reset" type="reset" class="btn" value="Reset" /-->
						
					</div>
				</div>
			</form>
		</div>
	</div>
	<!--#include file="../inc/footer.asp" -->
</div>
</body>
</html>
